package top.lixunda.ecommerce.server.business;

import top.lixunda.commerce.common.core.entity.MessageObject;
/**
 * @author Xumda
 * @version time:2019/11/26 14:07
 */
@SuppressWarnings({"unused", "SameParameterValue", "WeakerAccess"})
public class BaseController extends Base {

    public <S> MessageObject<S> getMessageObject(int code, String message, S obj) {
        return new MessageObject<S>().setCode(code).setMsg(message).setObject(obj);
    }

    public <S> MessageObject<S> getSuccessMessageObject(String message, S obj) {
        return new MessageObject<S>().setCode(MessageObject.CODE_OK).setMsg(message).setObject(obj);
    }

    public <S> MessageObject<S> getSuccessMessageObject(String message) {
        return getSuccessMessageObject(message, null);
    }

    public <S> MessageObject<S> getErrorMessageObject(String message) {
        return new MessageObject<S>().setCode(MessageObject.CODE_ERROR).setMsg(message);
    }

    public <S> MessageObject<S> getErrorMessageObject(String message, S obj) {
        return new MessageObject<S>().setCode(MessageObject.CODE_ERROR).setMsg(message).setObject(obj);
    }

}
